<?php
$frontendOptions = array(
	// cache for 24 houers
   'lifetime' => 86400,
   'debug_header' => false, // for debugging
	// Disable caching by default for all URLs
	'default_options' => array(
		'cache' => false
	),
   'regexps' => array(
       // cache whole site..
       '^/$' => array(
			'cache' => true,
			'make_id_with_get_variables' => true,
			'cache_with_get_variables' => true,
	
			'make_id_with_cookie_variables' => true,
			'cache_with_cookie_variables' => true,
		),
		'^/[\w]{2,4}/(strona|site)/' => array(
		'cache' => true,
			// 
			'make_id_with_get_variables' => true,
			'cache_with_get_variables' => true,
	
			'make_id_with_cookie_variables' => true,
			'cache_with_cookie_variables' => true,
			//'cache_with_session_variables' => false,
			//'cache_with_files_variables' => false,
			//'cache_with_cookie_variables' => false,
			// and we cache even there are some variables in $_POST
		//	'cache_with_post_variables' => true,
			// but the cache will be dependent on the $_POST array
		//	'make_id_with_post_variables' => true
		)
   )
);

$backendOptions = array(
    'cache_dir' => TMP_PATHNAME . 'cache/page/'
);

// getting a Zend_Cache_Frontend_Page object
require_once 'Zend/Cache.php';
/* @var $cache Zend_Cache_Frontend_Page */
$cache = Zend_Cache::factory('Page',
                             'File',
                             $frontendOptions,
                             $backendOptions);

$cache->start();

// drobna sztuczka z czyszczeniem cache site
if (array_key_exists('__cache', $_GET))
{
	switch ($_GET['__cache'])
	{
		case 'all': $cache->clean(Zend_Cache::CLEANING_MODE_ALL); break;
		case 'cancel': $cache->cancel(); break;
	}
}